﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace YJKTextDimension.DimCreator
{
	public class DistanceComparer : IComparer<ReferenceInfo>
	{
		public DistanceComparer(XYZ refPoint)
		{
			this.m_ReferencePoint = refPoint;
		}

		public int Compare(ReferenceInfo ref1, ReferenceInfo ref2)
		{
			return ref1.ThePosition.DistanceTo(this.m_ReferencePoint).CompareTo(ref2.ThePosition.DistanceTo(this.m_ReferencePoint));
		}

		private XYZ m_ReferencePoint;
	}
}
